<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');
/**
 * Flexigrid CodeIgniter implementation
 *
 * PHP version 5
 *
 * @category  CodeIgniter
 * @package   Flexigrid CI
 * @author    Frederico Carvalho (frederico@eyeviewdesign.com)
 * @version   0.3
 * Copyright (c) 2008 Frederico Carvalho  (http://flexigrid.eyeviewdesign.com)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 */
if (!function_exists('getDataToPost')) {

    /**
     * Build Javascript to display grid
     *
     * @param	grid id, or the div id
     * @param	url to make the ajax call
     * @param	array with colModel info: 		 
     * 			* 0 - display name
     * 	 		* 1 - width
     * 	 		* 2 - sortable
     * 			* 3 - align
     * 			* 4 - searchable (2 -> yes and default, 1 -> yes, 0 -> no.)
     * 			* 5 - hidden (TRUE or FALSE, default is FALSE. This index is optional.) 
     * @param	array with button info: 	
     * 		 	* 0 - display name
     * 	 		* 1 - bclass
     * 	 		* 2 - onpress
     * @param	default sort column name
     * @param	default sort order
     * @param	array with aditional parameters
     * @return	string
     */
 function getDataToPost($pdata=NULL) {
			$postdata = http_build_query($pdata);
			$opts = array('http' =>
				array(
					'method' => 'POST',
					'header' => 'Content-type: application/x-www-form-urlencoded',
					'content' => $postdata
				)
			);

			$context = stream_context_create($opts);

			return $context;
		}
    

}
?>